class Solution {
public:
    bool isUgly(int num) {
        if(num==0){return false;}
        int zy[3]={2,3,5};
        for(int i=0;i<3;i++){
            while(true){
                if(num==1){return true;}
                if(num%zy[i]!=0){break;}
                num/=zy[i];
            }
        }
        return false;
    }
};